Skip to content

docs: Expand README for hts221 driver.#220

Merged
nedseb merged 2 commits intomainfrom
hts221-expend-readme
Mar 23, 2026
Merged

docs: Expand README for hts221 driver.#220
nedseb merged 2 commits intomainfrom
hts221-expend-readme

Conversation

@Charly-sketch
Copy link
Copy Markdown
Contributor

Closes #191
Parent issue #194

Description

Expand lib/hts221/README.md to match the level of detail of other drivers (e.g. wsen-hids, ism330dl).

Changes

  • Added Features section (measurement modes, calibration, power management)
  • Added I²C address section (default: 0x5F)
  • Added Basic usage example
  • Documented full API (reading, configuration, calibration, power)
  • Added Examples section
  • Added Notes about temperature calibration (set_temp_offset, calibrate_temperature)
  • Kept original source attribution

Result

README is now complete, consistent with other drivers, and ready for users and contributors.

Copy link
Copy Markdown
Contributor

@nedseb nedseb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L'API Reference est bien structurée et complète. Mais il y a une erreur critique et plusieurs points à corriger.

Erreur critique

  1. Commande mpremote complètement fausse :
# Ce que tu as écrit (faux) :
mpremote mount lib/htss221 run examples/htss221/examples/humidity.py

# Ce qu'il faut (correct) :
mpremote mount lib/hts221 run lib/hts221/examples/humidity.py

"htss221" avec double s apparaît deux fois, et le chemin examples/htss221/examples/ n'existe pas. C'est typiquement le genre d'erreur qu'on obtient en copiant la sortie d'un LLM sans la tester. Avant de soumettre, teste toujours la commande mpremote sur ta machine.

Contenu manquant

  1. Pas de section "Sensor Specifications" — Les autres README harmonisés (wsen-hids, wsen-pads) ont un tableau avec les specs du composant (plage de mesure, précision, interface). Ajoute-le pour le HTS221 (plage humidité : 0–100 %RH, précision : ±3.5 %RH ; plage température : −40 à +120 °C, précision : ±0.5 °C).

  2. set_av() — valeurs possibles non documentées — "Controls internal averaging" ne suffit pas. Quelles valeurs peut-on passer en paramètre ? Regarde dans const.py et liste les options comme le fait le README wsen-hids pour ses constantes.

  3. set_odr() — valeurs possibles non documentées — "0 = one-shot mode" mais quelles sont les autres valeurs ? 1 Hz, 7 Hz, 12.5 Hz ? Regarde dans const.py.

  4. set_continuous(odr) — comportement d'erreur non documenté — Le driver raise ValueError si odr=0. C'est important à mentionner pour que l'utilisateur ne soit pas surpris.

Cohérence

  1. Section I²C Address* Default address: **0x5F** mélange puce markdown et gras. Sois cohérent avec les autres README : soit un tableau, soit une ligne simple "Default I²C address: 0x5F".

  2. Source — Même remarque que sur les autres PR : la phrase d'intro "This library is a port of..." est vague. Mets le lien directement dans l'intro ou supprime la phrase.

Rappel

Avant de soumettre, vérifie systématiquement :

  • Les commandes mpremote en les exécutant
  • Les noms de fichiers avec ls
  • Les constantes et valeurs avec cat const.py

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Expands the hts221 driver documentation to match the richer, more standardized READMEs used by other drivers in this repository, improving usability for end users and contributors.

Changes:

  • Added sections covering features, I²C address, basic usage, and a structured API reference.
  • Documented calibration and power-management capabilities.
  • Added an examples section and preserved upstream source attribution.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/hts221/README.md Outdated
Comment on lines +170 to +171
* In one-shot mode, the driver automatically waits for data readiness.
* In power-down or one-shot mode, measurements trigger automatically when needed.
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Notes say that “in one-shot mode, the driver automatically waits for data readiness”, but read_one_shot() only triggers a one-shot conversion and sleeps a fixed 15 ms before reading registers (it doesn’t poll the STATUS bits like _ensure_data() does). Consider rewording to clarify that the readiness polling applies to temperature()/humidity()/read() via _ensure_data(), while read_one_shot() uses a fixed delay.

Suggested change
* In one-shot mode, the driver automatically waits for data readiness.
* In power-down or one-shot mode, measurements trigger automatically when needed.
* In one-shot mode, calls to `temperature()`, `humidity()`, and `read()` poll the sensor's status bits internally to wait for data readiness before returning.
* The `read_one_shot()` helper starts a one-shot conversion and then waits a fixed delay (15 ms) before reading the registers, rather than polling the status bits.
* In power-down or one-shot mode, a new measurement is started when you call `temperature()`, `humidity()`, `read()`, or `read_one_shot()`; the sensor does not take measurements autonomously in the background in these modes.

Copilot uses AI. Check for mistakes.
Comment thread lib/hts221/README.md Outdated
Run with:

```bash
mpremote mount lib/htss221 run examples/htss221/examples/humidity.py
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mpremote command uses htss221 in both the mount path and the script path, which doesn’t match the actual driver directory (lib/hts221/) or the example location (lib/hts221/examples/humidity.py). This will fail if copied. Update the command to point at the real paths.

Suggested change
mpremote mount lib/htss221 run examples/htss221/examples/humidity.py
mpremote mount lib/hts221 run lib/hts221/examples/humidity.py

Copilot uses AI. Check for mistakes.
Comment thread lib/hts221/README.md
Comment on lines +60 to 72
```python
device_id()
```

Returns the sensor device ID (`WHO_AM_I` register).

### Data Readiness

```python
data_ready()
temperature_ready()
humidity_ready()
```
Copy link

Copilot AI Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the API section, the code blocks list method names without an instance (e.g., device_id() / temperature()), which reads like top-level functions. Since these are instance methods on HTS221, document them as sensor.device_id(), sensor.temperature(), etc. (consistent with other driver READMEs).

Copilot uses AI. Check for mistakes.
@nedseb
Copy link
Copy Markdown
Contributor

nedseb commented Mar 23, 2026

README réécrit en f6ddfc1 pour traiter tous les commentaires :

Revue :

  1. Commande mpremote htss221 — Corrigée → lib/hts221
  2. Section Sensor Specifications — Ajoutée avec tableau complet (plage, précision, Device ID)
  3. set_av() valeurs — Documenté comme registre brut avec renvoi vers la datasheet
  4. set_odr() valeurs — Listées (0 = one-shot, 1 = 1 Hz, 2 = 7 Hz, 3 = 12.5 Hz)
  5. set_continuous(odr=0) ValueError — Documenté
  6. I²C Address format — Intégrée dans le tableau des specs
  7. Source — Lien inline dans l'intro, section Source supprimée
  8. Trailing whitespace — Supprimé

Copilot :

  1. Notes sur one-shot/data readiness — Précisé : temperature()/humidity()/read() utilisent _ensure_data() (polling status), tandis que read_one_shot() utilise un délai fixe de 15 ms
  2. Commande mpremote — Déjà corrigé au point 1
  3. Méthodes sans instance — Toutes préfixées avec sensor. pour la cohérence

Prête à merger.

@nedseb nedseb merged commit 851c9b9 into main Mar 23, 2026
3 checks passed
@nedseb nedseb deleted the hts221-expend-readme branch March 23, 2026 15:58
@semantic-release-updater
Copy link
Copy Markdown

🎉 This PR is included in version 0.0.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: Expand README for hts221 driver.

3 participants